<style scoped>
    .layout{
        border: 1px solid #d7dde4;
        background: #f5f7f9;
        position: relative;
        border-radius: 4px;
        overflow: hidden;
    }
    .layout-breadcrumb{
        padding: 10px 15px 0;
    }
    .layout-content{
        min-height: 500px;
        /* max-height: 500px; */
        margin: 15px;
        overflow: hidden;
        background: #fff;
        border-radius: 4px;
    }
    .layout-content-main{
        padding: 10px;
    }
    .layout-copy{
        text-align: center;
        padding: 10px 0 20px;
        color: #9ea7b4;
    }
    .layout-menu-left{
        background: #464c5b;
    }
    .layout-header{
        height: 60px;
        background: #fff;
        box-shadow: 0 1px 1px rgba(0,0,0,.1);
    }
    .layout-logo-left{
        width: 90%;
        height: 30px;
        background: #5b6270;
        border-radius: 3px;
        margin: 15px auto;
    }
    .layout-ceiling-main a{
        color: #9ba7b5;
    }
    .layout-hide-text .layout-text{
        display: none;
    }
    .ivu-col{
        transition: width .2s ease-in-out;
    }
</style>
<template>
    <div class="layout"  :class="{'layout-hide-text': spanLeft < 5}">
        <Row type="flex">
            <Col :span="spanLeft" class="layout-menu-left">
                <Menu active-name="1" theme="dark" width="auto">
                    <div class="layout-logo-left"></div>
                    <MenuItem name="1"> 
                        <Icon type="ios-home" :size="20"></Icon>
                        <span class="layout-text" @click="[module='首页',path='/',flag=false]">
                         <router-link to='/'>首页</router-link>
                        </span>
                    </MenuItem>
                    <MenuItem name="2">
                        <Icon type="ios-people" :size="20"></Icon>
                        <span class="layout-text" @click="[module='用户管理',,path='/user',flag=true]">
                          <router-link to='/user'>用户管理</router-link>
                        </span>
                    </MenuItem>
                    <MenuItem name="3">
                        <Icon type="folder" :size="20"></Icon>
                        <span class="layout-text"  @click="[module='分类管理',path='/cate',flag=true]">
                          <router-link to='/cate'>分类管理</router-link>
                        </span>
                    </MenuItem>
                    <MenuItem name="4">
                        <Icon type="ios-paper" :size="20"></Icon>
                        <span class="layout-text" @click="[module='新闻管理',path='/news',flag=true]">
                          <router-link to='/news'>新闻管理</router-link>
                        </span>
                    </MenuItem>
                    <MenuItem name="5">
                        <Icon type="archive" :size="20"></Icon>
                        <span class="layout-text" @click="[module='上传管理',path='/upload',flag=true]">
                          <router-link to='/upload'>上传管理</router-link>
                        </span>
                    </MenuItem>
                    <MenuItem name="6">
                        <Icon type="pricetags" :size="20"></Icon>
                        <span class="layout-text" @click="[module='产品管理',path='/user',flag=true]">
                          <router-link to='/ceshi'>产品管理</router-link>
                        </span>
                    </MenuItem>
                </Menu>
            </Col>
            <Col :span="spanRight">
                <div class="layout-header">
                    <Button type="text" @click="toggleClick">
                        <Icon type="navicon" size="32"></Icon>
                    </Button>
                </div>
                <div class="layout-breadcrumb">
                    <Breadcrumb class="navBread">
                        <BreadcrumbItem :to="'/'">首页</BreadcrumbItem>
                        <BreadcrumbItem v-if="flag"><router-link :to="path">{{module}}</router-link></BreadcrumbItem>
                    </Breadcrumb>
                </div>
                <div class="layout-content">
                    <div class="layout-content-main">
                      <router-view></router-view>
                    </div>
                </div>
                <div class="layout-copy">
                    2017 &copy; JiangWei
                </div>
            </Col>
        </Row>
    </div>
</template>
<script>
    export default {
        data () {
            return {
                spanLeft: 5,
                spanRight: 19,
                module: "首页",
                path:'/',
                flag:false,
            }
        },
        computed: {
            iconSize () {
                return this.spanLeft === 5 ? 14 : 24;
            }
        },
        methods: {
            toggleClick () {
                if (this.spanLeft === 5) {
                    this.spanLeft = 2;
                    this.spanRight = 22;
                } else {
                    this.spanLeft = 5;
                    this.spanRight = 19;
                }
            },
        },
    }
</script>